/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package amor_boutique_management;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author LovingXu
 */
public class AmorConnection {
    public static String CONNECTION_STRING = "jdbc:postgresql:"+"amor_boutique";
    public static String USERNAME = "postgres";
    public static String PASSWORD = "123456";
    
    public static Connection CONNECTION = null;
    
    public static void connect() {
        try {
            Class.forName("org.postgresql.Driver");
            CONNECTION = DriverManager.getConnection(CONNECTION_STRING, USERNAME, PASSWORD);
        } catch (SQLException | ClassNotFoundException ex) {
            Logger.getLogger(AmorConnection.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public static void disconnect() {
        try {
            CONNECTION.close();
        } catch (SQLException ex) {
            Logger.getLogger(AmorConnection.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
